package com.example.leetcode.stack;

import com.example.leetcode.linkedlist.common.LinkedListUtils;
import com.example.leetcode.linkedlist.common.ListNode;
import com.example.leetcode.stack.common.StackUtils;

import java.util.Arrays;

/**
 * Definition for singly-linked list.
 * public class ListNode {
 * int val;
 * ListNode next;
 * ListNode() {}
 * ListNode(int val) { this.val = val; }
 * ListNode(int val, ListNode next) { this.val = val; this.next = next; }
 * }
 */
class Solution1019 {
    public int[] nextLargerNodes(ListNode head) {
        return StackUtils.nextLargerNodes(head);
//        return StackUtils.nextLargerNodes2(head);
    }
}

public class leetcode1019 {
    public static void main(String[] args) {
        Solution1019 solution1019 = new Solution1019();
        int[] nums = {2, 7, 4, 3, 5};
        System.out.println(Arrays.toString(solution1019.nextLargerNodes(LinkedListUtils.generateLinkedListByArray(nums))));
    }
}
